package com.ljx.itbbs.server.user.controller;


import com.ljx.itbbs.common.domain.vo.resp.ApiResult;
import com.ljx.itbbs.server.user.domain.vo.req.CheckCodeParamsReq;
import com.ljx.itbbs.server.user.domain.vo.resp.CheckCodeResp;
import com.ljx.itbbs.server.user.service.CodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Api(tags = "验证码接口")
@RestController
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private CodeService codeService;

    @ApiOperation("生成验证码")
    @GetMapping("/generate")
    public ApiResult<CheckCodeResp> generate(@Valid CheckCodeParamsReq checkCodeParamsReq){
        CheckCodeResp checkCodeResp = codeService.generate(checkCodeParamsReq);

        return ApiResult.success(checkCodeResp);
    }

}
